
package com.joysuch.wwyt.datadump.biz.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.zlg.common.datadump.annotation.DataDumpEntity;
import cn.zlg.common.datadump.annotation.DataDumpField;
import com.joysuch.wwyt.bp.entity.dsl.QBpJob;
import com.joysuch.wwyt.datadump.biz.processor.BpJobImportProcessor;
import com.joysuch.wwyt.datadump.biz.query.BpJobDumpQueryBean;
import com.joysuch.wwyt.risk.entity.dsl.QRiskDistrict;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@DataDumpEntity(name = "job-dump", entity = QBpJob.class, exportQueryConditions = BpJobDumpQueryBean.class,importProcessors = BpJobImportProcessor.class,
        businessName = "岗位", batchDeleteField = "showState", deleteFlagValue = "44")
@Data
public class BpJobDumpBean {

    @NotNull
    @Length(max = 64, min = 1)
    @Excel(name = "岗位", width = 20)
    @DataDumpField(field = "name", importKey = true)
    private String name;

    //报警模板
    @Length(max = 100)
    @Excel(name = "报警模板", width = 20)
    @DataDumpField(field = "alarmTemplateName")
    private String alarmTemplateName;


    @Length(max = 512)
    @Excel(name = "岗位描述")
    @DataDumpField(field = "description")
    private String description;

    @Length(max = 64)
    @Excel(name = "风险分区编号", width = 16)
    @DataDumpField(field = "riskDistrictId", referenceEntity = QRiskDistrict.class, referenceEntityField = "code",
            refEntityNotExistsMessage = "风险区域编号不存在，请先创建区域或核对编号准确性"
    )
    private String riskDistrictCode;

    @Length(max = 64)
    @Excel(name = "岗位地点", width = 20)
    @DataDumpField(field = "site")
    private String site;

    @Pattern(regexp = "[0-9]{0,3}", message = "请填写数字，最多3位")
    @Length(max = 64)
    @Excel(name = "岗位最小人数", width = 16)
    @DataDumpField(field = "minPeopleNumber")
    private String minPeopleNumber;

    @Pattern(regexp = "[0-9]{0,3}", message = "请填写数字，最多3位")
    @Excel(name = "岗位最大人数", width = 20)
    @DataDumpField(field = "maxPeopleNumber")
    private String maxPeopleNumber;

}
